//
//  ViewController.m
//  demo5-系统类代理的使用
//
//  Created by Maggie on 15/8/8.
//  Copyright (c) 2015年 fmning. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UIAlertViewDelegate,UIActionSheetDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - 退出登录
- (IBAction)logoffClicked:(id)sender {
    
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"您确定要退出吗?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
    
    [alert show];
}

#pragma mark - 实现代理方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    //处理Yes按钮的操作
    if (buttonIndex == 1) {
        NSLog(@"退出");
    }
}
- (IBAction)uploadClicked:(id)sender {
    
    UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"选择图片" delegate:self cancelButtonTitle:@"Cancle" destructiveButtonTitle:@"从相册选择" otherButtonTitles:@"相机", nil];
    
    [sheet showInView:self.view];
}


- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (buttonIndex == 0) {
        NSLog(@"从相册中选择");
    }
    else{
        NSLog(@"打开相机");
    }
}
@end






